#ifndef BOOTSTRAPSERVICE_H
#define BOOTSTRAPSERVICE_H

#include "bootstrap.h"

class BootstrapService: public QtService<QCoreApplication>
{
public:
    BootstrapService(int argc, char *argv[]):
        QtService<QCoreApplication>(argc, argv, SP_NAME)
    {
        setServiceDescription("Bootstrap Service For QVertex Project");
    }
protected:
    void start()
    {
        QCoreApplication *app = application();
        sp_setRegValue(REG_BOOTSTRAP,"serviceName",serviceName());

        // App/Stage
        QString rootPath=app->applicationDirPath();
        if(rootPath.endsWith("bin"))
            rootPath=rootPath.remove("bin");
        sp_setRegValue(REG_BOOTSTRAP,"rootPath",rootPath);

        bootstrap=new Bootstrap(app);
        bootstrap->start();
    }

    void stop()
    {
        bootstrap->stop();
    }

private:
    Bootstrap *bootstrap;
};

#endif // BOOTSTRAPSERVICE_H
